<?php
 use common\components\helpers\Fun;
?>
<?php $form = \yii\widgets\ActiveForm::begin(['enableAjaxValidation' => true,'enableClientValidation' => false,'options'=>['class'=>'form-validate']]); ?>
<table width="100%" class="table-form">
    <tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['regist_name']; ?></th>
        <td><?= $form->field($model, 'regist_name', ['template' => '{input}{error}{hint}'])->textInput(['style' => 'width:250px','class' => 'input-text']) ?></td>
    </tr>
    <tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['name']; ?></th>
        <td><?= $form->field($model, 'name', ['template' => '{input}{error}{hint}'])->textInput(['class' => 'input-text']) ?></td>
    </tr>
    <tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['admin_id']; ?></th>
        <td style="display: inline-block;width: 206px"><?= $form->field($model, 'admin_id', ['template' => '{input}{error}{hint}'])->widget(\kartik\select2\Select2::className(),['data'=>$admin,'options' => ['placeholder' => '请选择']]) ?></td>
    </tr>
    <tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['mec_principal']; ?></th>
        <td style="display: inline-block;width: 206px"><?= $form->field($model, 'mec_principal', ['template' => '{input}{error}{hint}'])->widget(\kartik\select2\Select2::className(),['data'=>$admin_formec,'options' => ['placeholder' => '请选择']]) ?></td>
    </tr>
    <?php if(empty($model->id)) { ?>
    <tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['mechanic_username']; ?></th>
        <td><?= $form->field($model, 'mechanic_username', ['template' => '{input}{error}{hint}'])->textInput(['class' => 'input-text','autocomplete'=>'off']) ?></td>
    </tr>
    <?php } ?>
    <tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['contacts']; ?></th>
        <td><?= $form->field($model, 'contacts', ['template' => '{input}{error}{hint}'])->textInput(['class' => 'input-text']) ?></td>
    </tr>
    <tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['telephone']; ?></th>
        <td><?= $form->field($model, 'telephone', ['template' => '{input}{error}{hint}'])->textInput(['class' => 'input-text']) ?></td>
    </tr>

    <tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['status']; ?></th>
        <td><?= $form->field($model, 'status', ['template' => '{input}{error}{hint}'])->radioList([ '2'=>'已结束', '1'=>'合作中', '0'=>'未开始',]) ?></td>
    </tr>
    <tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['enrollment']; ?></th>
        <td><?= $form->field($model, 'enrollment', ['template' => '{input}{error}{hint}'])->textInput([ 'class' => 'input-text enrolment-number']); ?></td>
    </tr>
    <tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['info']; ?></th>
        <td><?= $form->field($model, 'info', ['template' => '{input}{error}{hint}'])->widget(\doumiaoduo\ueditor\Ueditor::className(),['clientOptions'=>[
                'serverUrl'=>\common\components\helpers\Fun::url(['/uploader/action']),
                'toolbars'=>[['fullscreen', 'source', '|', 'undo', 'redo', '|','bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript','rowspacingtop', 'rowspacingbottom', 'lineheight', '|','justifyleft', 'justifycenter', 'justifyright', 'justifyjustify','simpleupload','removeformat']],
                'initialFrameWidth'=>'95%'
            ],]);?></td>
    </tr>

    <!--<tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['reduction']; ?></th>
        <td><?= $form->field($model, 'reduction', ['template' => '{input}{error}{hint}'])->textInput([ 'class' => 'input-text'])->hint('整数'); ?></td>
    </tr>
    <tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['return_ratio']; ?></th>
        <td><?= $form->field($model, 'return_ratio', ['template' => '{input}{error}{hint}'])->textInput([ 'class' => 'input-text'])->hint('若为33.33%，则填写33.33，课时费的百分比'); ?></td>
    </tr>
    <tr>
        <th class="zx-goods-table"><?= $model->attributeLabels()['enrollment_ratio']; ?></th>
        <td><?= $form->field($model, 'enrollment_ratio', ['template' => '{input}{error}{hint}'])->textInput([ 'class' => 'input-text'])->hint('若为33.33%，则填写33.33，总课时的百分数'); ?></td>
    </tr>-->
</table>
<div class="m_top_10 btn" style="display: none">
    <?= \yii\helpers\Html::submitButton('提交', ['class' => "button", 'id' => 'dosubmit']) ?>
</div>
<?php \yii\widgets\ActiveForm::end(); ?>

<p style="display: none" data-mode="<?=$mode?>" id="mode"></p>
<?php
$js = <<<JS
   if($('#mode').data('mode')=='B'){
    $('.field-mechanic-enrollment').parent().parent().hide();
    $('.proportion').parents('tr').hide();
   }else{
     $('.field-mechanic-enrollment').parent().parent().show();

     $('.proportion').parents('tr').show();
   }
    var parent_id=$('.table-form').data('parent');
    if(parent_id!=''){
        $('.proportion').parents('tr').hide();
    }
   $('#mechanic-parent_id').change(function(){
        parent_id=$(this).val();
       if(parent_id!=''){
            $('.proportion').parents('tr').hide();
       }else{
            $('.proportion').parents('tr').show();
       }
   })
JS;
$this->registerJs($js);
?>
